<?php

namespace App\Http\Controllers\Admin;

use App\Models\Setting;
use Session;

class SettingController extends BaseController
{

    public function __construct(Setting $setting)
    {
        parent::__construct();
        $this->setting = $setting;
    }

    public function getIndex()
    {
        $rows = $this->setting->getAllCache();
        $type = request('type',1);
        return view('admin.setting.index', compact('rows','type'));
    }

    public function postIndex()
    {
        $res = $this->setting->editSetting(request());
        return redirect()->back()->with('message', $res)->withInput();
//        return dd(Session::get('message'));
    }
}
